<%-- 
    Document   : inquiry_detail
    Created on : Dec 9, 2008, 7:52:13 PM
    Author     : Nicholai
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<table>
    <tr>
        <td class="menucon">
            <html:link action="/inquiry_getinquiries.do" title="Go to main.">Inquiries</html:link>
        </td>
    </tr>
</table>
<html:messages id="messages" property="customMessage" message="true">
    <div class="heading4"><bean:write name="messages"/></div>
</html:messages>
<html:errors/>
<html:messages id="messages" property="message" message="true">
    <ul>
        <li><bean:write name="messages" filter="false"/></li>
    </ul>
</html:messages>
<table>
    <tr>
        <td>
            <table cellspacing="0">
                <tr>
                    <td>Quotation Number</td>
                    <td>:</td>
                    <td>${inquiry.noQuotation}</td>
                </tr>
                <tr>
                    <td>Date</td>
                    <td>:</td>
                    <td><f:formatDate type="date" value="${inquiry.tanggal}"/></td>
                </tr>
                <tr>
                    <td>Sales</td>
                    <td>:</td>
                    <td>${inquiry.sales.nama}</td>
                </tr>
                <tr>
                    <td>Projects</td>
                    <td>:</td>
                    <td>${inquiry.project.nama}</td>
                </tr>
                <tr>
                    <td>Product Specification</td>
                    <td>:</td>
                    <td>${inquiry.productSpec.nama}</td>
                </tr>
                <tr>
                    <td>Standard Specification</td>
                    <td>:</td>
                    <td>${inquiry.standartSpec.nama}</td>
                </tr>
                <tr>
                    <td>Finishing</td>
                    <td>:</td>
                    <td>${inquiry.finishing.nama}</td>
                </tr>
                <tr>
                    <td>Contractor</td>
                    <td>:</td>
                    <td>${inquiry.kontraktor.nama}</td>
                </tr>
                <tr>
                    <td>Consultant</td>
                    <td>:</td>
                    <td>${inquiry.konsultan.nama}</td>
                </tr>
                <tr>
                    <td valign="top">Address</td>
                    <td valign="top">:</td>
                    <td>${inquiry.alamat}</td>
                </tr>
                <tr>
                    <td>Branch Office</td>
                    <td>:</td>
                    <td>${inquiry.cabang.kota}</td>
                </tr>
            </table>
        </td>
    </tr>
    <tr><td><b>Inquiry's Items</b></td></tr>
    <tr>
        <td><html:link action="/inquiry_additem.do?id=${inquiry.id}">Add Item</html:link></td>
    </tr>
    <tr>
        <td>
            <table>
                <tr class="table_header">
                    <th>No.</th>
                    <th>Code</th>
                    <th>Name</th>
                    <th>Weight</th>
                    <th>Quantity</th>
                    <th width="140px">Action</th>
                </tr>
                <c:set var="x" value="0"/>
                <c:forEach items="${inquiry.items}" var="item">
                    <tr>
                        <td>${x+1}.</td>
                        <td>${item.produk.kode}</td>
                        <td>${item.produk.nama}</td>
                        <td align="right">${item.produk.weight} ${item.produk.hargaHpp.unit.nama}</td>
                        <td align="right">${item.jumlah}</td>
                        <td align="center">
                            <html:link action="/inquiry_preupdateitem.do?id=${x}">Edit</html:link>
                            <html:link action="/inquiry_deleteitem.do?id=${x}">Remove</html:link>
                        </td>
                    </tr>
                    <c:set var="x" value="${x+1}"/>
                </c:forEach>
                <c:if test="${x==0}">
                    <tr><td colspan="6" align="center">Inquiry have no item.</td></tr>
                </c:if>
                    <tr><th colspan="6" class="table_header">New item that you request to add.</th></tr>
                <c:set var="x" value="0"/>
                <c:forEach items="${listItem}" var="item">
                    <tr>
                        <td>${x+1}.</td>
                        <td>${item.produk.kode}</td>
                        <td>${item.produk.nama}</td>
                        <td>${item.produk.weight}</td>
                        <td>${item.jumlah}</td>
                        <td>
                            <html:link action="/inquiry_preupdateitem.do?id=${x}&scope=session">Edit</html:link>
                            <html:link action="/inquiry_removeitem.do?id=${x}">Remove</html:link>
                        </td>
                    </tr>
                    <c:set var="x" value="${x+1}"/>
                </c:forEach>
                <c:if test="${x==0}">
                    <tr><td colspan="6" align="center">Inquiry have no requested item.</td></tr>
                </c:if>
                <c:if test="${x!=0}">
                    <tr><td colspan="6" class="warning_link"><html:link action="/inquiry_saveitem.do">Save requested Item</html:link></td></tr>
                </c:if>
                <tr class="table_footer">
                    <td colspan="10">PT. Dhemar Nusantara - PT. Rahmi Ida Nusantara</td>
                </tr>
            </table>
        </td>
    </tr>
</table>
